package com.wlstock.funi.utils;


import com.wlstock.funi.R;

public class NotiIdGenerator {

	//即将买入提醒
	public static final int ID_WILL_BUY = -78888;
	//机器人止损
	public static final int ID_AI_SELL = -1;
	//服务器异常
	public static final int ID_SERVER_ERROR = -2;
	//市场统计(幅度统计)
	public static final int ID_MARKET_STA_COUNT = -88889;
	//市场统计(包括当天涨停数，跌停数，大于5%，小于-5％)
	public static final int ID_MARKET_STA = -88888;
	//仓位信息过期
	public static final int ID_POSITION_OUTDATE = -88887;
	//登录过期
	public static final int ID_LOG_OUTDATE = -88886;
	//仓位解析失败
	public static final int ID_PARSE_POSITION_STATE = -88885;
	//策略选股
	public static final int ID_STRATEGYFUND = -88884;
	//今日仓位
	public static final int ID_STOREPOSITION = -88883;
	//资金情况:
	public static final int ID_MONEY_FLOW = -88882;
	//整体市场情绪
	public static final int ID_MARKET_FINAL = -88881;
	//打新
	public static final int ID_NEW_STOCK_SUCCESS = -88880;
	//设置概况
	public static final int ID_SETTING_STA = -88879;
	//自动下单
	public static final int ID_AUTO_BUY = -88878;

	public static enum GenerFrom {
		MDPARSER, REALTRADE, WLTRADER, MYSTOCK_PRESET , MYSTOCK_KEEP, MYSTOCK_STOP, SELFFUND
	}
	
	public static int generate(String stkNo, GenerFrom from){
		switch (from) {
            case MDPARSER://均线位置的判断
                return Integer.valueOf("-"+stkNo);
            case REALTRADE://真实交易
                return Integer.valueOf(stkNo)*-1+1;
            case WLTRADER://万隆人交易
                return Integer.valueOf(stkNo)+10000;
            case MYSTOCK_PRESET://到达设置条件
                return Integer.valueOf(stkNo)+10001;
            case MYSTOCK_KEEP://持仓通知
                return Integer.valueOf(stkNo)+10002;
            case MYSTOCK_STOP://止损止盈
                return Integer.valueOf(stkNo)+10003;
            case SELFFUND://自选
			    return Integer.valueOf(stkNo)+10004;
		default:
			break;
		}
		return 1;
	}


	public static int getNotiRingRaw(GenerFrom from){
		switch (from){
			case WLTRADER:
				return R.raw.ma5;
			case MYSTOCK_STOP:
				return R.raw.ma5;
			case REALTRADE:
				return R.raw.ma5;
			case MYSTOCK_PRESET:
				return R.raw.ma5;
			case MDPARSER:
				return R.raw.ma5;
			default:
				return -1;
		}
	}
	
	public static int generate(String stkNo,String offsetType){
		if (TradeSetUtils.LOSE_OFFSET.equals(offsetType) || TradeSetUtils.WIN_OFFSET.equals(offsetType)) {
			//止损止盈
			return generate(stkNo, GenerFrom.MYSTOCK_STOP);
		}else if ("NORMAL".equals(offsetType)) {
			//持有
			return generate(stkNo, GenerFrom.MYSTOCK_KEEP);
		}else if ("INTIME".equals(offsetType)) {
			//到达设置条件
			return generate(stkNo, GenerFrom.MYSTOCK_PRESET);
		}
		return 1;
	}

}
